import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86185
 * Date: 2023-10-17
 * Time: 22:33
 */
public class Exam1017 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        dfs(arr, 0, n);
        System.out.println(count);
    }

    static int count;
    static Map<Integer, Integer> map = new HashMap<>();
    private static void dfs(int[] arr, int begin, int end) {
        if(begin + 1 >= end) {
            return;
        }
        int sum = 0;
        int xsum = 1;
        for(int i = begin; i < end; i++) {
            sum += arr[i];
            xsum *= arr[i];
        }
        if(sum > xsum) {
            if(map.containsKey(sum) && map.get(sum) == xsum) {
                ;
            }else {
                count++;
                map.put(sum, xsum);
            }
        }
        dfs(arr, begin, end - 1);
        dfs(arr, begin + 1, end);
    }

    public static void main1(String[] args) {
        int[] months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
        Scanner scanner = new Scanner(System.in);
        int y = scanner.nextInt();
        int m = scanner.nextInt();
        int d = scanner.nextInt();
        if(y % 4 == 0 && y % 100 != 0 || y % 400 == 0) {
            months[2] = 29;
        }
        int ans = 0;
        for(int i = 1; i < m; i++) {
            ans += months[i];
        }
        ans += d;
        System.out.println(ans);
    }
}
